package com.bolehui.web;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bolehui.base.result.Result;
import com.bolehui.domain.po.Jobpreference;
import com.bolehui.domain.po.Organizationexperience;
import com.bolehui.domain.vo.OrganizationExVO;
import com.bolehui.service.OrganizationexperienceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chendongjie
 * @since 2025-03-18
 */
@RestController
@RequestMapping("/organizationexperience")
public class OrganizationexperienceController {

    @Autowired
    private OrganizationexperienceService organizationexperienceService;

    @RequestMapping(params = "action=saveOrganEx")
    public Result saveOranExperience(@RequestBody OrganizationExVO organizationExVO, @RequestParam Long userId){
        return organizationexperienceService.saveOranEx(organizationExVO, userId);
    }

    @RequestMapping(params = "action=list")
    public Result list(Long userId){
        return Result.success(organizationexperienceService.list(new QueryWrapper<Organizationexperience>().eq("candidate_id", userId)));
    }

    @RequestMapping(params = "action=update")
    public Result update(@RequestBody OrganizationExVO organizationExVO, Long userId){
        return organizationexperienceService.update(organizationExVO, userId);
    }

    @RequestMapping(params = "action=delete")
    public Result delete(Long id){
        return Result.success(organizationexperienceService.removeById(id));
    }
}

